#!/usr/bin/perl -w

package Purl::Player;

use base qw(Purl::Object);
use Digest::MD5 qw(md5_base64);

sub password {
	my $self = shift;
	if (@_) { $self->{password} = md5_base64(shift) }
	return $self->{password};
}

sub sex {
	my $self = shift;
	if (@_) { $self->{sex} = shift }
	return $self->{sex};
}

sub ip {
	my $self = shift;
	if (@_) { $self->{ip} = shift }
	return $self-{ip};
}

sub site {
	my $self = shift;
	if (@_) { $self->{site} = shift }
	return $self->{site};
}

sub last {
	my $self = shift;
	if (@_) { $self->{lastconn} = shift }
	return $self->{lastconn};
}

sub alias {
	my $self = shift;
	if (@_) { 
		my $alias = shift;
		$alias = lc $alias;
		return 0 if (exists $main::playerIds{$alias}); 
		$main::playerIds{$alias} = $self->{dbref};
		$self->{alias} = $alias;
	}
	return $self->{alias};
}

sub gag {
	my $self = shift;
	if (@_) { 
		my $if = shift;
		my $who = shift;
		if ($if) {
			$self->{gag} .= " $who";
		} else {
			$self->{gag} =~ s/ $who//;
		}
	}
	return $self->{gag};
}

sub activeFd {
	my $self = shift;
	if (@_) { $self->{activeFd} = shift }
	return $self->{activeFd};
}


1;
